package com.moon.listener;

//import com.moon.dao.TAuctionMapper;
//import com.moon.entity.TAuction;
import com.moon.utils.JsonUtils;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tk.mybatis.mapper.entity.Example;

import java.io.IOException;
import java.util.Calendar;
import java.util.Date;

@Component
public class AddOrderListener {

    @Autowired
    RabbitTemplate rabbitTemplate;


    @RabbitListener(queues = "deadLetterOrderExchange")
    public void onMsg(Integer n, Channel channel, Message message) throws IOException {
        System.out.println("开始延迟 deadLetterOrderExchange-------"+n);
        try {
            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
        } catch (Exception e) {
            channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, false);
            //
        }
        //
    }
}
